import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-directive',
  templateUrl: './directive.component.html',
  styleUrls: ['./directive.component.css']
})
export class DirectiveComponent implements OnInit {

  color='red';
  hide=true;
  index=0;
  constructor() { }

  ngOnInit() {
  }

  cgColor(){
      var a =this.index%3;
      this.index++;
      this.hide=!this.hide;
      switch(a){
          case 0:this.color='green';break;
          case 1:this.color='grey';break;
          case 2:this.color='red';

      }
  }

}
